{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "验证码图像channel: (60, 160, 3)\n",
      "验证码文本最长字符数 4\n",
      "INFO:tensorflow:Restoring parameters from ./save/cnn_train.model-900\n",
      "正确: 4524  预测: 4944\n"
     ]
    }
   ],
   "source": [
    "from cnn_data import gen_captcha_text_and_image\n",
    "from cnn_train import convert2gray\n",
    "from cnn_train import crack_captcha\n",
    "\n",
    "\n",
    "text, image = gen_captcha_text_and_image()\n",
    "\n",
    "image = convert2gray(image)  # 生成一张新图\n",
    "image = image.flatten() / 255  # 将图片一维化\n",
    "predict_text = crack_captcha(image)\n",
    "print(\"正确: {}  预测: {}\".format(text, predict_text))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
